﻿<link href="~/css/table.css" rel="stylesheet" />
<script src="~/js/jquery-1.11.1.js"></script>
<script src="~/js/vue.js"></script>
<div id="app">
    <form method="post">
        <table width="100%">
            <tr>
                <td>
                    <font color="black">
                        您正在做的业务是：人力资源--客户化设置--人力资源档案管理设置--I级机构设置
                    </font>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <input type="button" value="添加" class="BUTTON_STYLE1" onclick="window.location.href='first_kind_register'" />
                </td>
            </tr>
        </table>
        <table width="100%" border="1" cellpadding=0 cellspacing=1 bordercolorlight=#848284 bordercolordark=#eeeeee class="TABLE_STYLE1">
            <tr>
                <td width="20%" class="TD_STYLE1">
                    I级机构编号
                </td>
                <td width="20%" class="TD_STYLE1">
                    I级机构名称
                </td>
                <td width="25%" class="TD_STYLE1">
                    薪酬发放责任人编号
                </td>
                <td width="25%" class="TD_STYLE1">
                    销售责任人编号
                </td>
                <td width="5%" class="TD_STYLE1">
                    变更
                </td>
                <td width="5%" class="TD_STYLE1">
                    删除
                </td>
            </tr>
            <tr v-for="(item,index) in dt" :key="item.ffk_id">
                <td hidden>{{item.ffk_id}}</td>
                <td width="20%" class="TD_STYLE1">{{item.first_kind_id}}</td>
                <td width="20%" class="TD_STYLE1">{{item.first_kind_name}}</td>
                <td width="25%" class="TD_STYLE1">{{item.first_kind_salary_id}}</td>
                <td width="25%" class="TD_STYLE1">{{item.first_kind_sale_id}}</td>
                <td width="5%" class="TD_STYLE1"><a :href="'/client/first_kind_change/'+[item.ffk_id]">变更</a></td>
                <td width="5%" class="TD_STYLE1"><a v-on:click="del([item.ffk_id])">删除</a></td>
            </tr>
        </table>
    </form>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            dt: []
        },
        methods: {
            load: function () {
                var t = this;
                $.ajax({
                    url: "/client/first_kinds",
                    type: "post",
                    success: function (msg) {
                        var d = eval(msg);
                        t.dt = d;
                    }
                });
            },
            del: function (id) {
                if (confirm('确定要删除吗')) {
                    var t = this;
                    $.ajax({
                        url: "/client/first_kind_Delete",
                        type: "DELETE",
                        data: "id=" + id,
                        success: function (msg) {
                            if (msg > 0) {
                                t.load();
                            }
                        }
                    });
                }
            }
        }, mounted: function () {
            this.load();
        }
    });
</script>
